package com.mmlc.meimei.lichengkongjian.home;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.mmlc.inter.InterAdapter;
import com.mmlc.meimei.lichengkongjian.R;
import com.mmlc.network.responsebean.BannerResponseBean;
import com.mmlc.utils.ViewUtils;
import com.mmlc.utils.XUtils;

import java.util.List;

/**
 * Created by Administrator on 2016/8/6.
 */
public class HomeCategoryAdapter extends InterAdapter<BannerResponseBean.AdListBean> {
    public HomeCategoryAdapter(Context context, List<BannerResponseBean.AdListBean> datas) {
        super(context, datas);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null)
            convertView = LayoutInflater.from(context).inflate(R.layout.item_home_category, parent, false);

        ImageView iv_item = ViewUtils.ViewHolder.get(convertView, R.id.iv_item);
        XUtils.image(iv_item, datas.get(position).getImg(),
                XUtils.getImageOptionsBuilder().setImageScaleType(ImageView.ScaleType.CENTER_CROP).build());

        return convertView;
    }
}
